
app:registClass("PlayerController", "app.player.controllers.PlayerController")
app:registClass("HeadMenuController", "app.player.controllers.HeadMenuController")
app:registClass("OtherPlayerController", "app.player.controllers.OtherPlayerController")
app:registClass("ReportController", "app.player.controllers.ReportController")

local PlayerModel = import(".models.PlayerModel")

app:registInst(PlayerModel.new())

app:registInst(app:getClass("PlayerController").new({type="systemUI"}))
app:registInst(app:getClass("HeadMenuController").new({type="world", zOrder=SceneZOrder.playerOpZOrder}))
app:registInst(app:getClass("OtherPlayerController").new({type="systemUI"}))
app:registInst(app:getClass("ReportController").new({type="popupUI"}))

local model = app:getInst("PlayerModel")

-- 有人观察我
app.session:on("pb_query.S2C_QueryOtherUserNotify",function(ret)
    model:someoneObserveMe(ret)
end)

app.session:on("pb_server.S2C_ServerInfo",function(msg)
  	--model:setServerInfo(msg)

    -- 版本有更新
    app.session:setClientVersion(msg.clientVersion)
end)

-- 获得经验值
app.session:on("action.S2C_UserGetExp",function(ret)
    --app:sendMsg("PlayerController", "onGetExp", ret)
    -- TODO csg 暂时屏蔽获得经验飘字
    -- app:dispatchCustomEvent("EVENT_USER_EXP_GET",{exp=ret.exp})
end)

app.session:on("action.S2C_AASNotice",function(ret)
    local typ = protobuf.enum_id("action.HealthyGameFlag", ret.typ) or ret.typ
    app:sendMsg("PlayerController", "showWithTips", {type = typ, msg = ret.msg, title = ret.title, traceId = ret.traceId,
    jsonStr = ret.jsonStr})
end)